import lombok.extern.slf4j.Slf4j;

@Slf4j
public class MainPreventsBlocking {
    public static void main(String[] args) {
        Thread t = new Thread(() -> {
            int n = 10;
            while (n-- > 0) {
                try {
                    Thread.sleep(200);
                } catch (InterruptedException ignored) {
                }
                log.info("子线程运行中 n: {}", n);
            }
        });
        t.setDaemon(false);
        t.start();
        log.info("子线程已启动");
        log.info("主线程结束");
    }
}
